

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="team.edit" default="Edit Team" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir: '')}"><g:message code="home" default="Home" /></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="team.list" default="Team List" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="team.new" default="New Team" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="team.edit" default="Edit Team" /></h1>
            <g:if test="${flash.message}">
            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}" /></div>
            </g:if>
            <g:hasErrors bean="${teamInstance}">
            <div class="errors">
                <g:renderErrors bean="${teamInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${teamInstance?.id}" />
                <g:hiddenField name="version" value="${teamInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="awayMatches"><g:message code="team.awayMatches" default="Away Matches" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: teamInstance, field: 'awayMatches', 'errors')}">
                                    
<ul>
<g:each in="${teamInstance?.awayMatches}" var="soccerMatchInstance">
    <li><g:link controller="soccerMatch" action="show" id="${soccerMatchInstance.id}">${soccerMatchInstance?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="soccerMatch" params="['team.id': teamInstance?.id]" action="create"><g:message code="soccerMatch.new" default="New SoccerMatch" /></g:link>


                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="homeMatches"><g:message code="team.homeMatches" default="Home Matches" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: teamInstance, field: 'homeMatches', 'errors')}">
                                    
<ul>
<g:each in="${teamInstance?.homeMatches}" var="soccerMatchInstance">
    <li><g:link controller="soccerMatch" action="show" id="${soccerMatchInstance.id}">${soccerMatchInstance?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="soccerMatch" params="['team.id': teamInstance?.id]" action="create"><g:message code="soccerMatch.new" default="New SoccerMatch" /></g:link>


                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="league"><g:message code="team.league" default="League" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: teamInstance, field: 'league', 'errors')}">
                                    <g:select name="league.id" from="${League.list()}" optionKey="id" value="${teamInstance?.league?.id}"  />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name"><g:message code="team.name" default="Name" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: teamInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" value="${fieldValue(bean: teamInstance, field: 'name')}" />

                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="players"><g:message code="team.players" default="Players" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: teamInstance, field: 'players', 'errors')}">
                                    
<ul>
<g:each in="${teamInstance?.players}" var="playerInstance">
    <li><g:link controller="player" action="show" id="${playerInstance.id}">${playerInstance?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="player" params="['team.id': teamInstance?.id]" action="create"><g:message code="player.new" default="New Player" /></g:link>


                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="posts"><g:message code="team.posts" default="Posts" />:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: teamInstance, field: 'posts', 'errors')}">
                                    
<ul>
<g:each in="${teamInstance?.posts}" var="teamPostInstance">
    <li><g:link controller="teamPost" action="show" id="${teamPostInstance.id}">${teamPostInstance?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="teamPost" params="['team.id': teamInstance?.id]" action="create"><g:message code="teamPost.new" default="New TeamPost" /></g:link>


                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'update', 'default': 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'delete', 'default': 'Delete')}" onclick="return confirm('${message(code: 'delete.confirm', 'default': 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
